chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
    if (message.action === 'getUrlLevels') {
      chrome.tabs.query({ active: true, currentWindow: true }, function(tabs) {
        var currentTab = tabs[0];
        var url = new URL(currentTab.url);
        
        var levels = {
          protocol: url.protocol,
          hostname: url.hostname,
          port: url.port || 'default',
          pathname: url.pathname,
          search: url.search,
          hash: url.hash
        };
  
        sendResponse(levels);
      });
  
      return true; // Indicates that the response is sent asynchronously
    }
  });
  